import Vue from 'vue';
import Vuex from 'vuex';

import {appStoreConfigs} from 'app/config.js';


Vue.use(Vuex);


let localStorageState = localStorage.getParsedItem('StoreState');
let storeOptions = Vuex.Store.mergeStoreConfigsWhitInitState(appStoreConfigs,localStorageState);


const store = new Vuex.Store(storeOptions);

window.addEventListener("unload", function (event) {
  store.saveState();
});

export default store


